package com.go.ssm.web.action;

import com.go.ssm.domain.User;
import com.go.ssm.exception.service.UserNotFoundException;
import com.go.ssm.service.IUserService;
import com.opensymphony.xwork2.Action;

public class UserAction extends BaseAction {
	private static final long serialVersionUID = 1L;
	private IUserService userService;

	public String get() {
		return Action.SUCCESS;
	}

	public String list() {
		return Action.SUCCESS;
	}

	public String add() {
		return Action.SUCCESS;
	}

	public String edit() {
		return Action.SUCCESS;
	}

	public String delete() {
		User user = new User();
		try {
			userService.deleteUser(user);
		} catch (Exception e) {
			if (e instanceof UserNotFoundException)
				return Action.ERROR;
		}
		return Action.SUCCESS;
	}

	public IUserService getUserService() {
		return userService;
	}

	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

}
